﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EFMagic
{
    public static class EFMPOCOExtensions
    {
        public static object GetPropertyValue<T>(this T Source, string Name)
        {
            try
            {
                return typeof(T).GetProperty(Name).GetValue(Source, null);
            }
            catch (Exception ex)
            {
                return null;
            }
        }

        public static IEnumerable<string> GetProperties<T>(this T Source)
        {
            return (from x in typeof(T).GetProperties()
                    select x.Name);
        }
    }
}
